<?php

namespace app\index\validate;

use think\Validate;

class Add extends Validate
{
    protected $rule =   [
        'title'  => 'require|max:50',
        'keywords' => 'require',
        'description' => 'require',
        'thumb'     => 'require',
        'content'     => 'require',
    ];

    protected $message  =   [
        'title.require' => '标题不能为空',
        'title.max'     => '标题最多不能超过50个字符',
        'keywords.require'  => '关键字不能为空',
        'description.require'  => '内容提要不能为空',
        'thumb.require'   => '封面图片不能为空',
        'content.require'   => '内容不能为空',
    ];

    protected $scene = [
        //添加场景
        'add'  =>  ['title', 'keywords', 'description', 'thumb', 'content'],
        //修改场景
        'edit'  =>  ['title', 'keywords', 'description', 'content'],
    ];
}
